package com.zxy.supplier_system.server.controller

import com.zxy.supplier_system.server.entity.SystemServiceSetting
import com.zxy.supplier_system.server.service.SystemServiceService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RequestMapping("systemServices")
@RestController
class SystemServiceController(
    private val systemServiceService: SystemServiceService
) {

    @GetMapping("current")
    fun getCurrentSystemService():SystemServiceResponse{
        return this.systemServiceService.getCurrentSystemService().let {
            SystemServiceResponse(it.name)
        }
    }

    class SystemServiceResponse(
        val name:String,
    )

    @GetMapping("current/setting")
    fun getCurrentSystemSetting():SystemServiceSetting{
        return this.systemServiceService.getCurrentSystemSetting()
    }

}